package com.zijidelu.luframework.domain.event;

import com.zijidelu.luframework.base.concurrent.ConcurrencyStrategy;
import com.zijidelu.luframework.base.model.crud.CrudState;
import com.zijidelu.luframework.base.model.DataModel;
import com.zijidelu.luframework.domain.model.aggregate.AggregateRoot;
import com.zijidelu.luframework.domain.model.entity.Entity;
import lombok.Getter;

/**
 * 抽象领域实体状态变更事件。
 *
 * @author ZIJIDELU
 * @datetime 2025/11/13 23:36
 */
@Getter
public class AbstractEntityCrudEvent<A extends AggregateRoot<D, E>, E extends Entity<D>, D extends DataModel> extends AbstractDomainEvent<D, D, E, A> {

    private final CrudState crudState;

    protected AbstractEntityCrudEvent(A aggregateRoot, D payload, ConcurrencyStrategy concurrencyStrategy, CrudState crudState) {
        super(aggregateRoot, payload, concurrencyStrategy);
        this.crudState = crudState;
    }

    @Override
    public String getEventName() {
        return calcEventName("CrudEvent", crudState.name());
    }

}
